package com.xxzb.pack0720;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.Scanner;

public class Test10 {
    public static void main(String[] args) throws Exception{
        Scanner sc=new Scanner(System.in);
        System.out.println("请您输入姓名：");
        String uname=sc.next();
        System.out.println("请您输入更改后的密码：");
        String userpwd=sc.next();
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql:///gaofeng2207?useSSL=false";
        String username="root";
        String password="1234";
        Connection conn= DriverManager.getConnection(url,username,password);
        String sql="update gaofeng2207.users set userPwd=? where userName=?";
        PreparedStatement ps=conn.prepareStatement(sql);
        ps.setString(1,userpwd);
        ps.setString(2,uname);
        int row = ps.executeUpdate();
        System.out.println(row+"行受到影响！");


    }
}
